package io.renren.modules.report.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.report.entity.UserPanelShareEntity;
import io.renren.modules.report.service.UserPanelShareService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author august
 * @email 379249906@qq.com
 * @date 2020-07-17 10:29:19
 */
@RestController
@RequestMapping("report/userpanelshare")
public class UserPanelShareController {
    @Autowired
    private UserPanelShareService userPanelShareService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("report:userpanelshare:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userPanelShareService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("report:userpanelshare:info")
    public R info(@PathVariable("id") Long id){
		UserPanelShareEntity userPanelShare = userPanelShareService.getById(id);

        return R.ok().put("userPanelShare", userPanelShare);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("report:userpanelshare:save")
    public R save(@RequestBody UserPanelShareEntity userPanelShare){
		userPanelShareService.save(userPanelShare);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("report:userpanelshare:update")
    public R update(@RequestBody UserPanelShareEntity userPanelShare){
		userPanelShareService.updateById(userPanelShare);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("report:userpanelshare:delete")
    public R delete(@RequestBody Long[] ids){
		userPanelShareService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
